package com.itheima.mapper;

import com.itheima.pojo.Clazz;
import com.itheima.pojo.QueryParam;
import com.itheima.pojo.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface StudentMapper {
    /**
     * 根据班级ID统计学生数量
     */
    @Select("SELECT COUNT(*) FROM student WHERE id = #{id}")
    int countByClassId(Integer id);

    List<Student> list(QueryParam queryParam);


    void add(Student student);

    @Select("select * from student where id = #{id};")
    Student getById(Integer id);

    void update(Student student);

    void deleteByIds(List<Integer> ids);

    @Update("update student set violation_count = #{count},violation_score = #{score}  where id = #{id};")
    void updateById(Integer id, Integer count ,Integer score);

    @MapKey("clazz")
    List<Map<String, Object>> countStudentCountData();

    List<Map> countStudentDegreeData();
}
